package edu.java.ishop.dao.accessors;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;



import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
@Deprecated
public abstract class DatabaseDatasourceAccessor {
	private InitialContext ctx = null;
	

	public DatabaseDatasourceAccessor(){
		try {
			ctx = new InitialContext();
		} catch (NamingException e) {
			throw new RuntimeException(e);
		}
		
	}
//	public Connection openAccess() {
//		
//		
////		try {
////			Class.forName("org.postgresql.Driver");
////		} catch (ClassNotFoundException e) {
////			e.printStackTrace();
////		}
////		
////		return DriverManager.getConnection(getConnectionUrl(),getUsername(),getPassword());
//		try{
//			DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/postgres");
//			return ds.getConnection();
//		}catch(SQLException|NamingException e){
//			throw new RuntimeException(e);
//		}
//	}
	
//	protected abstract String getPassword();
//	protected abstract String getUsername();
//	protected abstract String getConnectionUrl();
}
